Add Recaptcha Component - resolves #192 #233
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi Jeffrey,
This PR wraps the Recaptcha functionality into its own Vue component.
Issue
Currently, when a user tries to submit a thread through the modal by clicking the Add New Thread button, the Recaptcha checkbox doesn't render as it is now inside the modal component. As a result, the validation fails when submitting the thread.
Fix
To fix this, I created a Recaptcha component. When the mounted event fires, it passes the sitekey to the Recaptcha render script to get the necessary code for the Recaptcha box. The tag itself is very similar to what we had before:
<recaptcha ref="recaptcha" sitekey="{{ config('services.recaptcha.key') }}"></recaptcha>
An old file
I also removed the
resources/views/threads/create.blade.php
file as we now use the modal. I couldn't see it referenced anywhere and the tests still passed.An existing unrelated bug
When testing, I noticed that when you submit a thread, we end up on the Thread detail screen. If we try to submit another thread, we end up getting a conflict with what looks like reply body field and the thread body field. It shows up in the validation errors.